package model

import (
	"time"
)

type Comment struct {
	ID              uint64    `gorm:"primaryKey;autoIncrement;comment:'id'" json:"id"`
	Content         string    `gorm:"type:varchar(120);not null;default:'';comment:'评论内容'" json:"content"`
	Avatar          string    `gorm:"type:varchar(160);comment:'头像'" json:"avatar"`
	Nickname        string    `gorm:"type:varchar(60);not null;default:'';comment:'昵称'" json:"nickname"`
	Mail            string    `gorm:"type:varchar(60);not null;default:'';comment:'邮箱'" json:"mail"`
	Website         string    `gorm:"type:varchar(60);comment:'网站地址'" json:"website"`
	IPZone          string    `gorm:"type:varchar(20);comment:'ip归属地'" json:"ip_zone"`
	RouterURL       string    `gorm:"type:varchar(60);not null;default:'';comment:'评论所属的路由';index:idx_router_url" json:"router_url"`
	CreateTime      time.Time `gorm:"type:datetime;not null;default:CURRENT_TIMESTAMP;comment:'创建时间';index:idx_create_time" json:"create_time"`
	UpdateTime      time.Time `gorm:"type:datetime;not null;default:CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP;comment:'最后一次更新时间'" json:"update_time"`
	IsDeleted       int8      `gorm:"type:tinyint(2);not null;default:0;comment:'删除标志位：0：未删除 1：已删除'" json:"is_deleted"`
	ReplyCommentID  *uint64   `gorm:"type:bigint unsigned;comment:'回复的评论 ID';index:idx_reply_comment_id" json:"reply_comment_id"`
	ParentCommentID *uint64   `gorm:"type:bigint unsigned;comment:'父评论 ID';index:idx_parent_comment_id" json:"parent_comment_id"`
	Reason          string    `gorm:"type:varchar(300);comment:'原因描述'" json:"reason"`
	Status          int8      `gorm:"type:tinyint(2);not null;default:1;comment:'1: 待审核；2：正常；3：审核未通过'" json:"status"`
}

func (Comment) TableName() string {
	return "t_comment"
}
